/*
   Copyright (c) 2011 Mizar Tools Contributors (mizartools.org)

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
/*  Contributors :
 *	2011-03-20 Marco Riccardi - initial implementation
 *
 */
package org.mizartools.system.executable;

import java.io.File;

import org.mizartools.system.EnvironFile;

public final class ExecutableFileManager {

	private static ExecutableFileManager executableFileManager;
	private static String binaryRoot;

	private ExecutableFileManager() {} 
	
	public static ExecutableFileManager getInstance() {
		if (executableFileManager == null) 
			executableFileManager = new ExecutableFileManager(); 
		return executableFileManager;
	}

	public String getCommand(ExecutableFileEnum executableFileEnum){
		return getBinaryRoot() + File.separator + executableFileEnum.toString();
	}
	
	public String getBinaryRoot(){
		if (binaryRoot == null) {
			if (EnvironFile.getMIZFILES().equals("/usr/local/share/mizar")) {
				binaryRoot = "/usr/local/bin";
			} else {
				binaryRoot = EnvironFile.getMIZFILES(); 
			}
		}
		return binaryRoot;
	}

	
	
	
	
	
}
